package cn.service.service.impl;

import cn.service.entiy.Order;
import cn.service.entiy.User;
import cn.service.feign.UserFeign;
import cn.service.service.UserFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserFeignServiceImpl implements UserFeignService {

    @Autowired
    private UserFeign userFeign;

    @Override
    public Boolean regUser(User user) {
        int i=userFeign.reg(user);
        if(i==1){
            return true;
        }
        return false;
    }

    @Override
    public Boolean login(User user) {
        return userFeign.login(user);
    }

    @Override
    public Order getUser(Order order) {
        User user=userFeign.getUserById(order.getUserId());
        order.setUserMobile(user.getMobile());
        order.setUserAvatar(user.getAvatar());
        return order;
    }
}
